﻿using System;
using System.Collections.Generic;
using System.Linq;
using H2.NET.Business.SMD.Model;
using H2.NET.Data.Common;

namespace H2.NET.Business.SMD.Service
{
    public static class BusinessService
    {
        #region 每次发起小流程自动插入子流程表
        public static void SaveChildProcess(string process, int incident,string status, DateTime? time = null, string username = "",string abortreason = "")
        {
            var childProcess = (t_smd_ChildProcess._Process == process & t_smd_ChildProcess._Incident == incident).ListFirst<t_smd_ChildProcess>();
            if (childProcess != null)
            {
                childProcess.Status = status;
                childProcess.AbortTime = time;
                childProcess.AbortReason = abortreason;
                childProcess.AbortUser = username;
                Storage.Save(childProcess);
            }
        }
        #endregion
        
    }
}